<?xml version="1.0" encoding="UTF-8"?>
<!--
To change this template, choose Tools | Templates
and open the template in the editor.
-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:h = "http://java.sun.com/jsf/html"
      xmlns:f = "http://java.sun.com/jsf/core"
      xmlns:ui="http://java.sun.com/jsf/facelets">
    <f:view>
        <h:head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>Your cart!</title>
        </h:head>
        <div id="divLogin">
            <ui:include src="login.xhtml" />
        </div>
        <h:body>
            <h1>Currently in the cart:</h1>
            <hr/>

            <h:dataTable value="#{shoppingCart.products}" var="it">
                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Name" />
                    </f:facet>
                    <h:outputText value="#{it.name}" />
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Category" />
                    </f:facet>
                    <h:outputText value="#{it.category}" />
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Description" />
                    </f:facet>
                    <h:outputText value="#{it.description}" />
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Price" />
                    </f:facet>
                    <h:outputText value="#{it.price}" />
                </h:column>

                <h:column>
                    <f:facet name="header">
                        <h:outputText value="Quantity" />
                    </f:facet>
                    <h:outputText value="#{it.quantity}" />
                </h:column>

                <h:column>
                    <h:form>
                        <h:commandButton value="+1" action="#{shoppingCart.addItem(it)}" />
                    </h:form>
                </h:column>

                <h:column>
                    <h:form>
                        <h:commandButton value="-1" action="#{shoppingCart.removeOneItem(it)}" />
                    </h:form>
                </h:column>

                <h:column>
                    <h:form>
                        <h:commandButton value="Remove All" action="#{shoppingCart.removeAllItem(it)}" />
                    </h:form>
                </h:column>

            </h:dataTable>

            <h:form>
                <h:commandButton value="Clear cart" action="#{shoppingCart.clear()}" />
            </h:form>

            <a href="http://localhost:44459/sasanshop/main.faces">Home</a>


        </h:body>
    </f:view>
</html>
